package fallingGame;

/**
 * <p>
 * Title: Star
 * </p>
 * <p>
 * Description: CS 343 Course Project Star is a GameObject that acts as a goal
 * in the game.
 * </p>
 * 
 * @author Nathanial Howard, Joe Costello, Dustin Schwingle, Jared Potter
 * @email nathanial.howard@my.uwrf.edu, anthony.costello@my.uwrf.edu,
 *        dustin.schwingle@my.uwrf.edu, jared.potter@my.uwrf.edu
 * @date December 01, 2011
 * @team Group 2
 */
public class Star extends GameObject {

	/**
	 * Star
	 * 
	 * default constructor
	 * 
	 * @ensure Star's width, height, x coordinate, and y coordinate will be
	 *         initialized
	 */
	public Star() {
		super();
		setWidth(16);
		setHeight(16);
		setY(-getWidth());
		setActive(true);
	}

	/**
	 * spawn
	 * 
	 * reset the values of the Star to be above the playing field. This spawns
	 * the star in the middle of the screen with a random x velocity for fun.
	 * 
	 * @ensure the star will be set at the top-center of the screen with a
	 *         random x velocity
	 */
	public void spawn() {

		// set it above the map
		setY(-getHeight());
		setY_vel(1.0f);

		// place it randomly in a horizontal manner
		setX(392);
		setX_vel((float) (Math.random() * 2 - 1));

	}

}
